package com.manong.bookstore.user.util;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class CookieFinder {
	public static Cookie findCookie(HttpServletRequest request, String cookieName) {
		Cookie[] cookies = request.getCookies();

		if(cookies == null)
			return null;

		for(Cookie cookie : cookies) {
			if(cookie.getName().equals(cookieName))
				return cookie;
		}

		return null;
	}
}
